//
//  TicketHelper.swift
//  ANOA
//
//  Created by 邱仙凯 on 2022/7/22.
//  Copyright © 2025 aowang. All rights reserved.
//

import UIKit
import ObjectMapper
class TicketHelper: NSObject {
    
}
var comHeadArr = ["基本信息","发票类型","报销类型","发票日期"]
private var haohaoArr = checkPlatform(type: .yuMeiKang) ? ["发票号码","金额(不含税)", "税率(%)","税额","价税合计"] : ["发票号码","金额(不含税)", "税额","价税合计"]



private var gougouArr = ["购买方","购买方税号","服务名称","销售方","销售方税号"]

var comTailArr = ["报销状态","查验状态","备注","发票照片","MainImg","辅助文件","AssistImg"]
 
private var datasource_spe = comHeadArr + ["发票代码"] + haohaoArr + gougouArr + comTailArr
private var datasource_spe_un = comHeadArr + ["发票代码"] +   haohaoArr  + comTailArr

 
private var datasource_valueadd = comHeadArr + ["发票代码"] +  haohaoArr +  ["校验码末6位"] + gougouArr  + comTailArr
private var datasource_valueadd_un = comHeadArr +  ["发票代码"] +  haohaoArr +  ["校验码末6位"]  + comTailArr


private var datasource_shudian = comHeadArr +  ["发票代码"] + haohaoArr +  ["数电票号码末6位"] + gougouArr + comTailArr
private var datasource_shudian_un = comHeadArr + ["发票代码"] +  haohaoArr +  ["数电票号码末6位"] + comTailArr

// MARK: - 其它
var datasource_other = comHeadArr + ["发票金额"]  + comTailArr
// MARK: - 全电
private var datasource_QD = comHeadArr + haohaoArr + gougouArr  + comTailArr
private var datasource_QD_un = comHeadArr + haohaoArr + comTailArr


 
private var datasource_trainSD = comHeadArr + ["发票号码","价税合计"] + gougouArr  + comTailArr
private var datasource_trainSD_un = comHeadArr + ["发票号码","价税合计"] + comTailArr

 
private var datasource_CZB_80 = comHeadArr + ["发票号码","发票金额"] + gougouArr  + comTailArr
private var datasource_CZB_80_un = comHeadArr + ["发票号码","发票金额","购买方","购买方税号","服务名称"]  + comTailArr
// MARK: - 火车票
private var datasource_train = comHeadArr + ["发票金额","出发城市","到达城市","车次/航班"] + comTailArr
// MARK: - 出租车票
private var datasource_taxi = comHeadArr + ["发票代码","发票号码","发票金额"] + comTailArr
// MARK: - 汽车票
private var datasource_bus = comHeadArr + ["发票代码","发票号码","发票金额","始发站","终点站"] + comTailArr
// MARK: - 定额发票  通用机打发票
private var dataSource_ding = comHeadArr + ["发票代码","发票号码","发票金额"] + comTailArr
// MARK: - 高速通行票
private var dataSource_highSpeed = comHeadArr + ["发票金额","入口","出口"] + comTailArr
// MARK: - 高速通行票 带校验码末6位
private var dataSource_highSpeed_yan = comHeadArr + ["发票金额","校验码末6位","入口","出口"] + comTailArr

// MARK: - 国外发票  因为是公司票夹特有的，把报销类型也砍掉了
private var dataSource_foreign = ["基本信息","发票类型","发票日期","发票号码","发票金额","服务名称","销售方"] + comTailArr




// 发票字典
public enum InvoiceType {
    public static let otherTax_00 = "00" //  其它
    public static let zzs_specific_01 = "01"   // 要查验
    public static let carSaled_03 = "03"  // 要查验
    public static let zzs_normal_04 = "04"  // 要查验
    public static let zzs_specific_dianzi_08 = "08" // 增值税专用发票(电子) 要查验
    public static let zzs_normal_dianzi_10 = "10"  // 要查验
    public static let zzs_juan_11 = "11"  // 要查验
    public static let jidaTax_12 = "12" // 通用机打发票
    public static let tongxingTax_14 = "14"  //
    public static let highSpeedTax_20 = "20"  // 高速通行票
    public static let quandianZ_21 = "21"// 全电 专用
    public static let quandianP_22 = "22" // 全电 普通
    public static let shudianZ_23 = "23" // 数电 专用
    public static let shudianP_24 = "24" // 数电 普通
    public static let trainTicket_SD_51 = "51" // 火车票数电
    public static let airtransportTicket_SD_61 = "61" // 航空 数电

    public static let CZB_80 = "80" // 财政部监制
    public static let SZ_QKL_81 = "81" // 深圳区块链
    public static let foreignTax_89 = "89"  // 国外发票
    public static let planeTax_90 = "90"
    public static let taxiTax_91 = "91"
    public static let huoche_92 = "92"
    public static let qichepiao_93 = "93" // 汽车票
    public static let dingTax_95 = "95"  // 定额发票
    
    public static let noTicket_99 = "99" //  其它无发票
    public static let invoiceCode2Name = ["00": "其他",
                                          "01": "增值税专用发票",
                                          "03": "机动车销售统一发票",
                                          "04": "增值税普通发票",
                                          "08": "增值税专用发票(电子)",
                                          "10": "增值税普通发票(电子)",
                                          "11": "增值税普通发票(卷式)",
                                          "12": "通用机打发票",
                                          "14": "通行费发票",
                                          "20": "高速车辆通行费票据",
                                          "21": "全电发票(专用发票)",
                                          "22": "全电发票(普通发票)",
                                          "23": "数电纸票(专用发票)",
                                          "24": "数电纸票(普通发票)",
                                          "51": "火车票(数电)",
                                          "61": "航空运输电子客票行程单(数电)",
                                          "80": "财政部监制发票",
                                          "81": "深圳区块链电子发票",
                                          "89": "国外发票",
                                          "90": "飞机票",
                                          "91": "出租车票",
                                          "92": "火车票",
                                          "93": "汽车票",
                                          "95": "定额发票",
                                          "99": "其他(无发票)",]
    // code 发票代码  输出发票中文
    static func code2Name(_ code:String) -> String {
        return InvoiceType.invoiceCode2Name[code].unwrap
    }
    // 输入发票  中文：代码   字典
    static func name2code(_ name:String) -> String {
        var code = ""
        InvoiceType.invoiceCode2Name.forEach {
            if $0.value == name {
                code = $0.key
            }
        }
        return code
    }
  
    
    
    /// type 发票类型  fcompany  是否公司      查验状态
    /// 返回 具体显示的数据列
    static func typeForArray(_ type:String,fcompany:Int,checkState:String) -> [String] {
        var tempArray = [String]()
        
        switch type {
        case InvoiceType.otherTax_00,
            InvoiceType.noTicket_99:  // 其他    二手车发票
            tempArray = datasource_other
        case InvoiceType.zzs_specific_01,
            InvoiceType.carSaled_03:
            tempArray = checkState == "1" ? datasource_spe : datasource_spe_un
        case InvoiceType.zzs_normal_04,
            InvoiceType.zzs_specific_dianzi_08,
            InvoiceType.zzs_normal_dianzi_10,
            InvoiceType.zzs_juan_11,
             InvoiceType.SZ_QKL_81:
            tempArray = checkState == "1" ? datasource_valueadd : datasource_valueadd_un
        case
            InvoiceType.shudianP_24,
            InvoiceType.shudianZ_23:
            tempArray = checkState == "1" ? datasource_shudian : datasource_shudian_un
        case InvoiceType.quandianZ_21,
            InvoiceType.airtransportTicket_SD_61,
            InvoiceType.quandianP_22:
            tempArray = checkState == "1" ? datasource_QD : datasource_QD_un
        case
            InvoiceType.trainTicket_SD_51:
            tempArray = checkState == "1" ? datasource_trainSD : datasource_trainSD_un
        case InvoiceType.CZB_80:
            tempArray =  checkState == "1" ? datasource_CZB_80 : datasource_CZB_80_un
        case InvoiceType.huoche_92, InvoiceType.planeTax_90:  // 火车 飞机
            tempArray = datasource_train
        case InvoiceType.taxiTax_91:  // 出租车票
            tempArray = datasource_taxi
        case InvoiceType.qichepiao_93:  // 汽车票
            tempArray = datasource_bus
        case InvoiceType.dingTax_95, InvoiceType.jidaTax_12:  // 定额发票  通用机打发票
            tempArray = dataSource_ding
        case InvoiceType.highSpeedTax_20, InvoiceType.tongxingTax_14:  // 定额发票   高速   通信费
            tempArray = dataSource_highSpeed
      
        case InvoiceType.tongxingTax_14:
            tempArray = dataSource_highSpeed_yan
        case InvoiceType.foreignTax_89:
            tempArray = dataSource_foreign
        default:
            tempArray = [""]
        }
        if fcompany == 1 {
            tempArray.insert("公司名称", at: 2)
        }
        return tempArray
        
    }
    
    
 
}

// 发票名称排序   个人票夹
public func invoiceNameArr() -> [String] {
    var arr = ["增值税普通发票",
               "增值税普通发票(电子)",
               "增值税普通发票(卷式)",
               "增值税专用发票",
               "增值税专用发票(电子)",
               "全电发票(专用发票)",
               "全电发票(普通发票)",
               "数电纸票(专用发票)",
               "数电纸票(普通发票)",
               "火车票(数电)",
               "航空运输电子客票行程单(数电)",
               "飞机票",
               "火车票",
               "出租车票",
               "汽车票",
               "通用机打发票",
               "通行费发票",
               "机动车销售统一发票",
               "财政部监制发票",
               "定额发票",
               "深圳区块链电子发票",
               "其他"]
    if TicketAppear.shared.noTicketMode {
        arr.append("其他(无发票)")
    }
    
    return arr
}
// 发票名称排序   公司票夹
public var invoiceComArr:[String] = ["增值税普通发票",
                                     "增值税普通发票(电子)",
                                     "增值税普通发票(卷式)",
                                     "增值税专用发票",
                                     "增值税专用发票(电子)",
                                     "全电发票(专用发票)",
                                     "全电发票(普通发票)",
                                     "数电纸票(专用发票)",
                                     "数电纸票(普通发票)",
                                     "通用机打发票",
                                     "财政部监制发票",
                                     "国外发票"]


// 发票类型  获取  特定的报销类型
func prepare4reimType(_ invoiceName:String)-> [String] {
    
    if checkPlatform(type: .haiXin) {
        return ["机票费", "车船费", "火车费", "市内交通费", "住宿费", "其他", "电话费", "油费"]
    }
    
    if invoiceName == "增值税普通发票" ||
        invoiceName == "增值税普通发票(电子)" ||
        invoiceName == "增值税普通发票（电子）" ||
        invoiceName == "通用机打发票" ||
        invoiceName == "增值税专用发票" ||
        invoiceName == "定额发票" ||
        invoiceName == "全电发票(专用发票)" ||
        invoiceName == "全电发票(普通发票)" ||
        invoiceName == "数电纸票(专用发票)" ||
        invoiceName == "数电纸票(普通发票)" ||

        invoiceName == "财政部监制发票" ||
        invoiceName == "深圳区块链电子发票" {
        return ["机票费","车船费","市内交通费","住宿费","其他"]
    } else if invoiceName == "增值税普通发票(卷式)"  {
        return ["车船费","市内交通费","住宿费","其他"]
    } else if invoiceName == "飞机票"  {
        return ["机票费"]
    } else if invoiceName == "火车票" ||
                invoiceName ==  "火车票(数电)" {
        return ["火车费"]
    }  else if invoiceName == "出租车票"  {
        return ["市内交通费"]
    }   else if invoiceName == "汽车票" || invoiceName == "通行费发票" {
        return ["市内交通费","其他"]
    }   else if invoiceName == "出租车票"  {
        return ["市内交通费"]
    }  else {
        return ["其他"]
    }
    
}



// 报销类型字典
public var reimbType = checkPlatform(type: .haiXin) ?
["1": "机票费",
"2": "车船费",
"3": "火车费",
"4": "市内交通费",
"5": "住宿费",
"6": "其他",
"7": "电话费",
"8": "油费",] :
                        
["1": "机票费",
"2": "车船费",
"3": "火车费",
"4": "市内交通费",
"5": "住宿费",
"6": "其他",]


// 把发票的json数据筛选一些装到模型
public func invoiceDicToModel(_ dic:NSDictionary) -> TicketModel {
    var model = TicketModel(json: "")
    var det = TicketDetailModel(json: "")
    let arr = dic["invoiceList"]
    let array = arr as! Array<Any>
    let adic = array.first as! NSDictionary
    let invoiceInfo = adic["invoiceInfo"] as! NSDictionary
    var detail: [String:Any] = [:]
    if let detailArr = invoiceInfo["detailList"] as? Array<Any> {
        if detailArr.count > 0 {
            if let ddd = detailArr.first as? [String : Any] {
                detail = ddd
            }
        }
    }
  
    model.fInvoicetypeId = invoiceInfo[CheckInvoiceKeys.invoiceType] as? String
    if model.fInvoicetypeId.isSome { model.fInvoicetypeNm = InvoiceType.code2Name(model.fInvoicetypeId.unwrap) }
    model.fInvoicecode = invoiceInfo[CheckInvoiceKeys.invoiceCode] as? String
    model.fInvoiceno = invoiceInfo[CheckInvoiceKeys.invoiceNo] as? String
    
    if let date = invoiceInfo[CheckInvoiceKeys.invoiceDate] as? String {
        var td = date
        if td.count > 7 && !td.contains("-") {
            td.insert("-", at: td.index(td.startIndex, offsetBy: 4))
            td.insert("-", at: td.index(td.startIndex, offsetBy: 7))
        }
        model.fInvoicedate = td
    }
    
    
    
      
    
    
    model.fCheckstate = "1"
    model.fVerifycode = invoiceInfo[CheckInvoiceKeys.checkCode] as? String
    model.fBuyername = invoiceInfo[CheckInvoiceKeys.buyerName] as? String
    model.fBuyertaxno = invoiceInfo[CheckInvoiceKeys.buyerTaxNo] as? String
    model.fTotalamount = invoiceInfo[CheckInvoiceKeys.totalAmount] as? String
    model.fInvoiceamount = invoiceInfo[CheckInvoiceKeys.invoiceAmount] as? String
    model.resultTip = invoiceInfo[CheckInvoiceKeys.resultTip] as? String
    model.resultCode = invoiceInfo[CheckInvoiceKeys.resultCode] as? String
    model.fSalername = invoiceInfo[CheckInvoiceKeys.salerName] as? String
    model.fSalertaxno = invoiceInfo[CheckInvoiceKeys.salerTaxNo] as? String
    model.fTaxamount = invoiceInfo[CheckInvoiceKeys.taxAmount] as? String

    let tempUnitprice = detail.keys.contains("unitPrice") ? detail["unitPrice"]! : "0.0"
    det.fUnitprice = floatTran(any2Str(tempUnitprice))
    let tempGoodsname = detail.keys.contains("goodsName") ? detail["goodsName"]! : "暂无"
    det.fGoodsname = any2Str(tempGoodsname)
    
    var ddd = [TicketDetailModel]()
    ddd.append(det)
    model.details = ddd
    
    return model
    
}
struct NewCheckModel: Mappable {
    
    var content: String?
    var id_key: String?
    init?(map: Map) {
        
    }
    // Mappable
    mutating func mapping(map: Map) {
        content <- map["content"]
        id_key <- (map["id_key"],StringTransform())
    }
}
// 是否需要pdf
func ifNeedPDF(one:TicketModel) -> Bool {
    return  (  one.fInvoicetypeId.unwrap == InvoiceType.zzs_specific_dianzi_08 ||
              one.fInvoicetypeId.unwrap == InvoiceType.zzs_normal_dianzi_10 ||
               one.fInvoicetypeId.unwrap == InvoiceType.quandianZ_21 ||
             one.fInvoicetypeId.unwrap == InvoiceType.quandianP_22 ||
               one.fInvoicetypeId.unwrap == InvoiceType.trainTicket_SD_51 ||
               one.fInvoicetypeId.unwrap == InvoiceType.airtransportTicket_SD_61   )
}
// 是否需要查验
func ifNeedCheck(one:TicketModel) -> Bool {
    return  (
        one.fInvoicetypeId.unwrap ==  InvoiceType.zzs_specific_01 ||
        one.fInvoicetypeId.unwrap == InvoiceType.carSaled_03 ||
        one.fInvoicetypeId.unwrap == InvoiceType.zzs_normal_04 ||
        one.fInvoicetypeId.unwrap == InvoiceType.zzs_specific_dianzi_08 ||
        one.fInvoicetypeId.unwrap == InvoiceType.zzs_normal_dianzi_10 ||
        one.fInvoicetypeId.unwrap == InvoiceType.zzs_juan_11 ||
        one.fInvoicetypeId.unwrap == InvoiceType.quandianZ_21 ||
        one.fInvoicetypeId.unwrap == InvoiceType.quandianP_22 ||
        one.fInvoicetypeId.unwrap == InvoiceType.shudianZ_23 ||
        one.fInvoicetypeId.unwrap == InvoiceType.shudianP_24 ||
        one.fInvoicetypeId.unwrap == InvoiceType.trainTicket_SD_51 ||
        one.fInvoicetypeId.unwrap == InvoiceType.airtransportTicket_SD_61 ||
        one.fInvoicetypeId.unwrap == InvoiceType.SZ_QKL_81
    )
}




// 是电子发票的话手动 赋值
func isElectronicInvoice(_ one:TicketModel) -> String {
    if  one.fInvoicetypeId.unwrap == InvoiceType.zzs_specific_dianzi_08 ||
        one.fInvoicetypeId.unwrap == InvoiceType.zzs_normal_dianzi_10 ||
        one.fInvoicetypeId.unwrap == InvoiceType.quandianP_22 ||
        one.fInvoicetypeId.unwrap == InvoiceType.quandianZ_21 ||
            one.fInvoicetypeId.unwrap == InvoiceType.airtransportTicket_SD_61  {
        return  "1"
    } else {
        return "0"
    }
}

// 拼接查验字符串
func jointURLString(_ one:TicketModel) -> String {
    // 去掉横杠的日期
    let dateX = one.fInvoicedate.unwrap.replacingOccurrences(of: "-", with: "")
    // 去掉空格
    let dateW = dateX.replacingOccurrences(of: " ", with: "")
    // 大部分用总金额
    var amount = "\(one.fTotalamount.unwrap)"
    // 特定的类型用金额(不含税)
    if one.fInvoicetypeId.unwrap == InvoiceType.zzs_specific_01 ||
        one.fInvoicetypeId.unwrap == InvoiceType.carSaled_03  ||
        one.fInvoicetypeId.unwrap == InvoiceType.shudianP_24 ||

        one.fInvoicetypeId.unwrap == InvoiceType.SZ_QKL_81  {
        amount = "\(one.fInvoiceamount.unwrap)"
    }
    // 发票qrcode 拼接规则
    // 01(不知道是什么),发票类型id(默认10),发票代码,发票号码,金额,日期,校验码,0000
    
    let qrStr = "01,\(one.fInvoicetypeId ?? "10"),\(one.fInvoicecode.unwrap),\(one.fInvoiceno.unwrap),\(amount),\(dateW),\(one.fVerifycode.unwrap),0000"
    
    return  qrStr
}
func models2json(_ arr:[TicketModel]) -> String {
    
    var jsonStr:String = ""
    for i in 0..<arr.count {
        let onejson = "{\"id_key\":\"\(arr[i].idKey.unwrap)\",\"qrcode\":\"\(jointURLString(arr[i]))\",\"f_type\":\"2\"}"
        if i == arr.count - 1 {
            jsonStr = jsonStr + onejson
        } else {
            jsonStr = jsonStr + onejson + ","
        }
    }
    let endjsonArr = "[" + jsonStr + "]"
    return endjsonArr
}


// 发票过滤协议
protocol invoiceFilterable where Self: UIViewController & GHDropMenuDelegate {
    
    
    func getDropMenu () -> GHDropMenu
    var filterPa:filterParam? { get set }
    var typeDicDesc:[String:String]? { get set }
    
    
    func delegateSearchAction()
    
}
extension invoiceFilterable {
    
    func getDropMenu() -> GHDropMenu {
        
        let  configuration = GHDropMenuModel()
        configuration.titles = creaFilterData4Invoice()
        configuration.recordSeleted = true
        
        let dropMenu = GHDropMenu.creatDropFilterMenuWidthConfiguration(configuration) { (tagArray) in
            self.getStrWith(tagArray: tagArray as! [GHDropMenuModel])
        }
        dropMenu.delegate = self
        dropMenu.durationTime = 0.3
        return dropMenu
    }
    
    
    
    var filterPa: filterParam? {
        set {
            objc_setAssociatedObject(self, &RuntimeKeys.filterPaKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC)
        }
        get {
            return (objc_getAssociatedObject(self, &RuntimeKeys.filterPaKey) as? filterParam) ?? nil
        }
    }
    var typeDicDesc: [String:String]? {
        set {
            objc_setAssociatedObject(self, &RuntimeKeys.typeDicDescKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC)
        }
        get {
            return (objc_getAssociatedObject(self, &RuntimeKeys.typeDicDescKey) as? [String:String]) ?? nil
        }
    }
    
    
    
    func creaFilterData4Invoice() -> [GHDropMenuModel] {
        
        
        // 时间
        var dataArray_time = [GHDropMenuModel]()
        let one = GHDropMenuModel()
        dataArray_time.append(one)
        
        // 金额
        var dataArray_price = [GHDropMenuModel]()
        let one_n = GHDropMenuModel()
        one_n.placeholderLeft = "请输入最小金额"
        one_n.placeholderRight = "请输入最大金额"
        dataArray_price.append(one_n)
        
        // 流水号
        var dataArray_lsh = [GHDropMenuModel]()
        let one_lsh = GHDropMenuModel()
        dataArray_lsh.append(one_lsh)
        // 发票号码
        var dataArray_no = [GHDropMenuModel]()
        let one_no = GHDropMenuModel()
        dataArray_no.append(one_no)
        // 标签
        var dataArray_label = [GHDropMenuModel]()
        let one_label = GHDropMenuModel()
        dataArray_label.append(one_label)
        
        /** 类型 */
        var dataArray_zhuangtai = [GHDropMenuModel]()
        for item in invoiceNameArr() {
            let one = GHDropMenuModel()
            one.tagName = item
            dataArray_zhuangtai.append(one)
        }
        
        
        let sectionHeaderTitles = ["标签","流水号","发票号码","金额","时间","发票类型"]
        var sections = [GHDropMenuModel]()
        for title in sectionHeaderTitles {
            let one = GHDropMenuModel()
            one.sectionHeaderTitle = title
            if title == "标签" {
                one.dataArray = dataArray_label
                one.filterCellType = .singleInput
            }  else if title == "流水号" {
                one.dataArray = dataArray_lsh
                one.filterCellType = .singleInput
            }else if title == "发票号码" {
                one.dataArray = dataArray_no
                one.filterCellType = .singleInput
            } else if title == "金额" {
                one.dataArray = dataArray_price
                one.filterCellType = .input
            } else if title == "时间" {
                one.dataArray = dataArray_time
                one.filterCellType = .timeChose
            }else if title == "发票类型" {
                one.dataArray = dataArray_zhuangtai
                one.filterCellType = .tag
            }
            
            sections.append(one)
        }
        
        var titlesArray = [GHDropMenuModel]()
        
        let finalOne = GHDropMenuModel()
        finalOne.sectionCount = 3.01
        finalOne.menuWidth = KSGlobal.screenW * 0.9
        finalOne.sections = sections
        titlesArray.append(finalOne)
        
        return titlesArray
        
    }
    // 选择后的回调
    func getStrWith(tagArray:[GHDropMenuModel]) {
        if typeDicDesc.isNone {
            typeDicDesc = InvoiceType.invoiceCode2Name.swapKeyValues()
        }
        
        for i in 0..<tagArray.count {
            switch i {
            case 0:
                filterPa!.biaoqian = tagArray[i].singleInput
                
            case 1:
                
                filterPa!.liushui = tagArray[i].singleInput
                
            case 2:
                filterPa!.no = tagArray[i].singleInput
            case 3:
                filterPa!.minMoney = tagArray[i].minValue
                filterPa!.maxMoney = tagArray[i].maxValue
            case 4:
                filterPa!.startDate = tagArray[i].beginTime
                filterPa!.endDate = tagArray[i].endTime
            case 5:
                
                
                if tagArray[i].tagSeleted {
                    if let c = typeDicDesc![tagArray[i].tagName] {
                        filterPa!.f_invoicetype_id = c
                    } else {
                        filterPa!.f_invoicetype_id = ""
                    }
                } else {
                    filterPa!.f_invoicetype_id = ""
                }
                
            default:
                break
            }
            
        }
        
        self.delegateSearchAction()
        
    }
    
}
 
struct InControlModel: Mappable {
    
    var invoice_verify: String?
     var invoice_origion: String?
    init?(map: Map) {
        
    }
    // Mappable
    mutating func mapping(map: Map) {
        invoice_verify <- (map["invoice_verify"],StringTransform())
        invoice_origion <- (map["invoice_origion"],StringTransform())
    }
}
